#ifndef Q_PCL_PLUGIN_MY_POINT_TYPES_H
#define Q_PCL_PLUGIN_MY_POINT_TYPES_H

//PCL
#include <pcl/pcl_base.h>
#include <pcl/ros/register_point_struct.h>
#include <pcl/point_types.h>

//! PCL custom point type used for reading RGB data
struct OnlyRGB
{
    union
    {
        union
        {
            struct
            {
				boost::uint8_t   b;
                boost::uint8_t   g;
                boost::uint8_t   r;
                boost::uint8_t   _unused;
            };
            float   rgb;
        };
    boost::uint32_t   rgba;
    };
    EIGEN_MAKE_ALIGNED_OPERATOR_NEW

} EIGEN_ALIGN16;


//! PCL custom point type used for reading intensity data
struct PointI
{
        float intensity;
        EIGEN_MAKE_ALIGNED_OPERATOR_NEW
} EIGEN_ALIGN16;


struct FloatScalar
{
        float scalar;
        EIGEN_MAKE_ALIGNED_OPERATOR_NEW
} EIGEN_ALIGN16;

struct IntScalar
{
        int scalar;
        EIGEN_MAKE_ALIGNED_OPERATOR_NEW
} EIGEN_ALIGN16;

//! PCL custom point type used for reading intensity data
struct OnlyNormals
{
        float normal_x;
        float normal_y;
        float normal_z;
        EIGEN_MAKE_ALIGNED_OPERATOR_NEW
} EIGEN_ALIGN16;


struct OnlyNormalsCurvature
{

    PCL_ADD_NORMAL4D;

    union {
        struct {
            float   curvature;
                };
            float   data_c [4];
        } ;
};

//TODO Check if this definition for a point with RGB is better
//struct EIGEN_ALIGN16 PointRGB
//{
//  union
//  {
//    union
//    {
//      struct
//      {
//        uint8_t b;
//        uint8_t g;
//        uint8_t r;
//        uint8_t _unused;
//      };
//      float rgb;
//    };
//    uint32_t rgba;
//  };

//  inline PointRGB ()
//  {}

//  inline PointRGB (const uint8_t b, const uint8_t g, const uint8_t r)
//    : b (b), g (g), r (r), _unused (0)
//  {}

//  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
//};

POINT_CLOUD_REGISTER_POINT_STRUCT (OnlyRGB,
								   (float, rgb, rgb)
)

POINT_CLOUD_REGISTER_POINT_STRUCT (PointI,
                                   (float, intensity, intensity)
)

POINT_CLOUD_REGISTER_POINT_STRUCT (FloatScalar,
                                   (float, scalar, scalar)
)

POINT_CLOUD_REGISTER_POINT_STRUCT (IntScalar,
                                   (float, scalar, scalar)
)

POINT_CLOUD_REGISTER_POINT_STRUCT (OnlyNormals,
                                   (float, normal_x, normal_x)
                                   (float, normal_y, normal_y)
                                   (float, normal_z, normal_z)
)

POINT_CLOUD_REGISTER_POINT_STRUCT (OnlyNormalsCurvature,
                                   (float, normal_x, normal_x)
                                   (float, normal_y, normal_y)
                                   (float, normal_z, normal_z)
                                   (float, curvature, curvature)
)

#endif // Q_PCL_PLUGIN_MY_POINT_TYPES_H
